<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="/WEB-INF/template/globalTemplate.xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:opif="http://java.sun.com/jsf/composite/opif">

    <ui:define name="title">#{msg['application.titre.administration.personnel']}</ui:define>
    <ui:define name="ariane">
        <h:commandLink action="/faces/index.xhtml"
                       value="#{msg['application.titre.accueil']}"  />
        >
        #{msg['application.titre.administration.personnel']}
    </ui:define>

    <ui:define name="content">
        <h:panelGroup styleClass="titre">#{msg['application.titre.administration.personnel']}</h:panelGroup>


        <h:link styleClass="lienAction lienCreer" outcome="utilisateur_gestion" value="Ajouter un utilisateur">  
            <f:param name="action" value="creer" />  
        </h:link>  

        <p:dataTable value="#{adminUtilisateursBean.listPersonnels}" 
                     var="personnel" 
                     id="dataTableListePersonnel"
                     emptyMessage="#{msg['application.personnels_liste.emptyMessage']}">
            <p:column>
                <f:facet name="header">  
                    <h:outputText value="Nom" />  
                </f:facet>  
                <h:outputText value="#{personnel.personnel.nom}"/>
            </p:column>
            <p:column>
                <f:facet name="header">  
                    <h:outputText value="Prénom" />  
                </f:facet>  
                <h:outputText value="#{personnel.personnel.prenom}"/>
            </p:column>
            <p:column>
                <f:facet name="header">  
                    <h:outputText value="Grade" />  
                </f:facet>  
                <h:outputText value="#{personnel.personnel.grade}"/>
            </p:column>
            <p:column>
                <f:facet name="header">  
                    <h:outputText value="Entite" />  
                </f:facet>  
                <h:outputText value="#{personnel.entite}"/>
            </p:column>            

            <p:column headerText="Actions">
                <h:link  outcome="utilisateur_gestion" 
                         value="Modifier">  
                    <f:param name="action" value="#{personnel.id}" />  
                </h:link>  
                &nbsp;
                <p:commandLink action="#{adminUtilisateursBean.supprimer(personnel)}"
                               value="Supprimer"
                               update="globalForm:confirm"  />
            </p:column>
        </p:dataTable>

        <h:link styleClass="lienAction lienCreer" outcome="utilisateur_gestion" value="Ajouter un utilisateur">  
            <f:param name="action" value="creer" />  
        </h:link> 

        <h:panelGrid columns="1">
            <p:panel header="Exporter les données"  >  
                <h:commandLink  >  
                    <p:graphicImage value="/resources/images/excel.png" />  
                    <p:dataExporter type="xls" target="dataTableListePersonnel" fileName="dataTableListePersonnel" excludeColumns="4"/>  
                </h:commandLink>  

                <h:commandLink  >  
                    <p:graphicImage value="/resources/images/csv.png" />  
                    <p:dataExporter type="csv" target="dataTableListePersonnel" fileName="dataTableListePersonnel" excludeColumns="4"/>  
                </h:commandLink>  

                <h:commandLink  >  
                    <p:graphicImage value="/resources/images/xml.png" />  
                    <p:dataExporter type="xml" target="dataTableListePersonnel" fileName="dataTableListePersonnel" excludeColumns="4"/>  
                </h:commandLink>  
            </p:panel>  
        </h:panelGrid>
    </ui:define>
</ui:composition>
